<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>通过url添加矢量数据</title>
    <link rel="stylesheet" href="../v6.4.3/css/ol.css">
    <link rel="stylesheet" href="css/common.css">
  </head>
  <body>
    <div id="map" style="height: 100%;"></div>

    <script src="../v6.4.3/build/ol.js"></script>
    <script>
      // GeoJSON是一种用于编码各种地理数据结构的格式
      let mapLayer = new ol.layer.Tile({
        source: new ol.source.OSM()
      })
      let vectorLayer = new ol.layer.vector({
        url: './data/line-samples.geojson',
        format: new ol.format.GeoJSON()
      })
    </script>
  </body>
</html>